Skip to main content

Console Logs

The output log can allow you to gain valuable information while coding your pipeline. To access the system logs you can open the system log menu from the toolbar.

The Lazy library will also output to the console when it experiences errors or warnings. The most common issues are an object type not applying to and element in an array.

Any return values will also be output to the system log. The first return value is the pipeline output.


Methods

You can log information to the console a variety of way. Depending on the serverity of the log information you can use one of the following methods.

  • Log(message, content?)
  • Info(message, content?)
  • Warn(message, content?)
  • Error(message, content?)

The message paramater is the text message you would like to output to the console.

The content paramater is optional, and is the data that will be displayed with the log as data content.

If you omit the content paramater and pass a Lazy Object as the message paramater, it will be treated as data content and be displayed as such.


Examples

Basic Example

The console methods paramaters can be called in many ways. If the message paramater is called with a Lazy object it will be treated as data content.

// INPUT: 20
if (payload.valueOf() == 20) {
Log("The input is 20!"); // displays message
Log(input); // displays data content
} else {
Error("The input NOT is 20!"); // displays message
Error(input); // displays data content
}

Message + Content Example

The console methods can be called with both a message and data content.

// INPUT: 20
if (payload.valueOf() == 20) {
Info("The input is 20!", input); // displays message + data content
} else {
Warn("The input NOT is 20!", input); // displays message + data content
}

JS Console Compatibility

While it is recommend you use the built in Log, Info, Warn and Error methods, you can still access the JavaScript console methods. However, only the following JS console methods are available: console.log, console.info, console.warn, and console.error.